import { ApiBase, Route, src, resHtml, valid } from 'koagun'
import { App, Ctx } from '../../app'

//挂载页面
export class DoctorApi extends ApiBase<App, Ctx> {
  constructor(app: App) {
    super(app)
    app.vite.include('doctor', src('/services/doctor/doctor.vue'))
    app.vite.include('addProcess', src('/services/doctor/addProcess.vue'))
    app.vite.include('dDetail', src('/services/doctor/detail.vue'))
    app.vite.include('begin', src('/services/doctor/begin.vue'))
    app.vite.include('qmp', src('/services/doctor/qmp.vue'))
  }

  public routes: Route<Ctx>[] = [ {
    tags: ['view'],
    path: '/doctor',
    middlewares: [],
    get: async (ctx: Ctx) => resHtml(ctx, await this.app.vite.render('doctor', {}, '首页'))
  }, {
    tags: ['view'],
    path: '/doctor/addProcess',
    middlewares: [],
    get: async (ctx: Ctx) => resHtml(ctx, await this.app.vite.render('addProcess', {}, '新建流程'))
  },{
    tags: ['view'],
    path: '/doctor/dDetail',
    middlewares: [],
    get: async (ctx: Ctx) => resHtml(ctx, await this.app.vite.render('dDetail', {}, '个人信息'))
  }, {
    tags: ['view'],
    path: '/doctor/begin',
    middlewares: [],
    get: async (ctx: Ctx) => resHtml(ctx, await this.app.vite.render('begin', {}, '开始治疗'))
  }, {
    tags: ['view'],
    path: '/doctor/qmp',
    middlewares: [],
    get: async (ctx: Ctx) => resHtml(ctx, await this.app.vite.render('qmp', {}, '查询修改流程'))
  }]
}
